package com.ckf.springbootinterceptor.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


/**
 * @className: SwaggerConfig
 * @description: Swagger的配置
 * @date: 2020/6/16
 * @author: cakin
 */
@Configuration
@EnableSwagger2 // 开启swagger
public class SwaggerConfig {
    /**
     * 配置Swagger信息
     * http://localhost:8080/swagger-ui.html  请求路径
     * 扫描控制器的包
     *
     * @return Docket
     */
    @Bean
    public Docket createDocketApi() {
        return new Docket(DocumentationType.SWAGGER_2).pathMapping("/").select().apis(RequestHandlerSelectors.basePackage("com.ckf"))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title("拦截系统项目 API 文档")
                        .description("演示SpringBoot整合Swagger...")
                        .version("2.2.3")
                        .contact(new Contact("cakin", "https://blog.csdn.net/chengqiuming", "798103175@qq.com"))
                        .license("The Apache License")
                        .licenseUrl("https://blog.csdn.net/chengqiuming")
                        .build());
    }
}
